package com.ruoyi.common.constants;

/**
 * 缓存常量信息
 *
 * @author ruoyi
 */
public class CacheConstant {
    public static final String VERSION = "V100";

    /**
     * 登录验证码
     */
    // redis key
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
    //登录验证码有效期（分钟）
    public static final long CAPTCHA_CODE_EXPIRATION = 2L;

    /**
     * 登录失败
     */
    // redis key
    public static final String LOGIN_ERROR_KEY = "login_error:";

    /**
     * 登录用户
     */
    public static final String LOGIN_USER_KEY = "loginUser";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 限流 cache key
     */
    public static final String RATE_LIMIT_KEY = "rate_limit:";

    /**
     * 充电抢 根据sn获取列表 cache key
     */
    public static String getChargerGunListBySn(String sn) {
        return "charger_gun:list:" + VERSION + ":" + sn;
    }

    /**
     * 计费模型缓存
     */
    public static String getChargerBillingModel(String sn) {
        return "charger_billing_model:" + VERSION + ":" + sn;
    }


    /**
     * 充电产生的订单id
     */
    public static String getTransactionId(String chargerSn, String number) {
        return "transaction_id:" + VERSION + ":" + chargerSn + ":" + number;
    }

    /**
     * 充电数据缓存
     */
    public static String getChargerGunData(String chargerSn, String number) {
        return "charger_gun_data:" + VERSION + ":" + chargerSn + ":" + number;
    }

    public static String getChargingSession(String chargerSn, String number) {
        return "charging:session:" + VERSION + ":" + chargerSn + ":" + number;
    }
}
